package com.eos.control.action.activity;

import com.eos.business.service.SysActivityBusinessService;
import com.eos.common.tool.ObjectUtils;
import com.eos.control.action.base.AbstractBaseAction;
import com.eos.orm.mybatis.model.ActivtyMappSales;
import com.eos.orm.mybatis.model.SysUser;

public class UpdateModelSalesSetAction extends AbstractBaseAction {
	private static final long serialVersionUID = -2990632727491636615L;
	private Integer activitySalesId;
	private Integer mappId;
	private Integer salesId;
	private Integer comboId;
	private Integer comboCycle; 
	private String salesPrice;
	private String isSubsidy;

	public void setActivitySalesId(Integer activitySalesId) {
		this.activitySalesId = activitySalesId;
	}

	public void setMappId(Integer mappId) {
		this.mappId = mappId;
	}

	public void setSalesId(Integer salesId) {
		this.salesId = salesId;
	}

	public void setComboId(Integer comboId) {
		this.comboId = comboId;
	}

	public void setComboCycle(Integer comboCycle) {
		this.comboCycle = comboCycle;
	}

	public void setSalesPrice(String salesPrice) {
		this.salesPrice = salesPrice;
	}

	public void setIsSubsidy(String isSubsidy) {
		this.isSubsidy = isSubsidy;
	}

	@Override
	public String execute() {
		try {
			if(null == activitySalesId || activitySalesId.intValue() <=0){
				statusCode = "200";
				message = "参数错误, 修改型号套餐关系失败!";
			}else{
				SysUser user = (SysUser) getSession().getAttribute("SysUser");
				String userId = user.getId()+"";
				String strTime = ObjectUtils.formatDate(null, "yyyy-MM-dd HH:mm:ss");
				ActivtyMappSales ams = new ActivtyMappSales();
				ams.setComboCycle(comboCycle);
				ams.setComboId(comboId);  
				ams.setIsSubsidy(isSubsidy);
				ams.setMappId(mappId);
				ams.setModifyTime(strTime);
				ams.setSalesId(salesId);
				ams.setSalesPrice(salesPrice); 
				ams.setId(activitySalesId);
				ams.setUpdateUserId(userId);
				SysActivityBusinessService sabs = new SysActivityBusinessService();
				String exeStatus = sabs.udpateActivitySales(ams);
				if("SUCCESS".equals(exeStatus)){
					statusCode = "200";
					message = "修改型号套餐关系信息成功!"; 
				}else{
					statusCode = "300";
					message = "系统繁忙, 修改型号套餐关系信息失败!";
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
			statusCode = "300";
			message = "系统异常, 修改型号套餐关系信息失败!";
		}
		return SUCCESS;
	}
}
